﻿
namespace DatabaseDoc.Parameters
{
    using System.Collections.Generic;

    public class ParameterOptions
    {
        private ParameterOptions()
        {
        }

        public OptionsRequirement Requirement { get; set; }

        public List<Option> Options { get; private set; }

        public Option Option { get; private set; }

        public bool HasSingleOption
        {
            get
            {
                return this.Option != null;
            }
        }

        public bool HasMultipleOptions
        {
            get
            {
                return this.Options != null && this.Options.Count > 0;
            }
        }

        public static ParameterOptions None()
        {
            return new ParameterOptions { Requirement = OptionsRequirement.NotValid };
        }

        public static ParameterOptions RequiredSingle(string name, string helpText, string description)
        {
            var parameterOptions = new ParameterOptions
                {
                    Requirement = OptionsRequirement.Required,
                    Option = new Option { Name = name, HelpText = helpText, Description = description, Requirement = OptionsRequirement.Required }
                };

            return parameterOptions;
        }        

        public static ParameterOptions OptionalSingle(string name, string helpText, string description)
        {
            var parameterOptions = new ParameterOptions
                {
                    Requirement = OptionsRequirement.Optional,
                    Option = new Option { Name = name, HelpText = helpText, Description = description, Requirement = OptionsRequirement.Optional }
                };

            return parameterOptions;
        }        
    }
}